package com.chen.cloud.micro.consumer.movie.controller;


import com.chen.cloud.micro.consumer.movie.dto.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author ChenTian
 * @date 2022/6/1
 */
@RestController
@RequestMapping("/movie/v1")
public class MovieController {

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/{id}")
    public User findById(@PathVariable Long id){
        User entity = restTemplate.getForObject("http://localhost:8000/user/v1/"+id, User.class);
        return entity;
    }

}
